package tom.oauth2.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import tom.oauth2.service.MyEventService;

/**
 * 使用Spring的ApplicationContext做事件订阅发布(观察者模式)
 * 该设计可以实现业务分离解耦
 * @author ZHUFEIFEI
 */
@RestController
public class MyEventController {

    @Autowired
    private MyEventService service;

    @GetMapping("/user/reg")
    public ResponseEntity<Object> createUser() {
        this.service.createUser();
        return ResponseEntity.ok("ok");
    }
}
